home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Development
/
General
/
ViewIt™ 2.24 Shareware
/
C++ Demo Projects
/
Symantec C++ 6.0 Demos
/
vDemoSC.cp
< prev
next >
Wrap
Text File
|
1993-12-15
|
4KB
|
114 lines
/* ViewIt 2.2 Demonstration Program */
/* ©FaceWare 1991-93. All Rights Reserved. */
#include "string.h"
#include "FaceStorSC.h"
extern struct FaceRec fRec;
short helpShown;
struct {
short myInteger;
float myReal;
char myString[100];
long myFlags;
} myRec;
short myList;
long oldTicks,newTicks;
float theReal,delta;
pascal void fJumpIt(Ptr thePtr) = {0x2257,0x2051,0x4E90};
pascal void OverProc(Ptr thePtr) {
if (fRec.uCommand == 264) /* a key down message? */
if (fRec.uParam[0] == 32) /* SPACE key pressed? */
fRec.uParam[0] = 95; /* convert to UNDERLINE */
fJumpIt(thePtr);} /* pass message to driver */
void main()
{
myRec.myInteger = 0;
myRec.myReal = 6.2;
strcpy(myRec.myString,"Hello");
myRec.myFlags = 10;
myList = 2;
oldTicks = 0;
theReal = 6.0;
/* Initialize FaceIt */
strcpy(fRec.uName, "vDemo.Rsrc");
FaceIt(0,DoInit);
/* Open Modeless Window using FWND 1000 */
FaceIt(0,NewWnd,1000,1);
for (;;) {
FaceIt(0,DoLoop);
/* Standard "About" Menu Item Selection */
if ((fRec.uMenuID == 101L) && (fRec.uMenuItem == 1L)) {
strcpy(fRec.uString, "Demonstration of the use of ViewIt\rwindows in a FaceIt-based program.");
FaceIt(0,ShoStr,3,12,(1L + (409L * 65536L)));
}
/* Hit in Modeless Window's "Open Modal" Button */
else if ((fRec.uMenuID == 1000L) && (fRec.wcHit == 2L)) {
FaceIt(0,NewWnd,1001); /* Open Modal Window */
for (;;) {
FaceIt(0,MdlWnd,1001); /* Process Modal Events */
if (fRec.wcHit == -1L) /* Hit in Close Box */
break;
else if (fRec.wcHit == 1L) { /* Hit in "Open Nested" Button */
FaceIt(0,NewWnd,1002,0,0,(long)&myRec); /* Open Nested Modal */
FaceIt(0,GetCtl,1002,0,3,3); /* Link Scrollable List */
FaceIt(0,LnkCtl,(long)fRec.cControl,(long)&myList,2L);
FaceIt(0,GetCtl,1002,0,2,3); /* Set Override Proc */
FaceIt(0,OvrCtl,(long)fRec.cControl,(long)&OverProc);
FaceIt(0,SetVal,1002); /* Set Linked Values */
helpShown = false;
for (;;) {
FaceIt(0,MdlWnd,1002,-2); /* Process Modal Events */
if (fRec.uMenuID == 0L) { /* No Message */
newTicks = TickCount();
if (newTicks > oldTicks + 60) {
oldTicks = newTicks;
FaceIt(0,GetCtl,1002,0,2,8);
SetCtlValue(fRec.cControl,(fRec.cValue % 4) + 1);
}
}
else if (fRec.wvHit == 1L) { /* Hit in View #1 */
if (fRec.wcHit == 1L) /* Hit in "OK" Button */
break;
else if (fRec.wcHit == 2L) { /* Hit in "Show/Hide" */
if (helpShown == true) {
FaceIt(0,ShoCtl,0,0,-3,2); /* Hide v3, Show v2 */
helpShown = false;}
else {
FaceIt(0,ShoCtl,0,0,-2,3); /* Hide v2, Show v3 */
helpShown = true;}
}
}
else if (fRec.wvHit == 2L) /* Hit in View #2 */
if ((fRec.wcHit == 6L)||(fRec.wcHit == 7L)) { /* Up/Down Arrow */
FaceIt(0,GetCtl,1002,0,2,(long)fRec.wcHit);
delta = 0.001 * (fRec.cMin - 2);
myRec.myReal = myRec.myReal + delta;
FaceIt(0,SetVal,1002,0,2,2);
Delay(5,&fRec.uI4);
}
}
FaceIt(0,GetVal,1002); /* Get Linked Values */
FaceIt(0,EndWnd,1002); /* Close Nested Modal */
}
}
FaceIt(0,EndWnd,1001); /* Close Modal Window */
}
/* Hit in Modeless Window's "Why ViewIt?" Button */
else if ((fRec.uMenuID == 1000L) && (fRec.wcHit == 3L)) {
FaceIt(0,NewWnd,1003,0,0,(long)&theReal);
FaceIt(0,SetVal,1003);
for (;;) {
FaceIt(0,MdlWnd,1003);
if (fRec.wcHit == 1L) break;}
FaceIt(0,GetVal,1003);
FaceIt(0,EndWnd,1003);
}
}
}